/* 全局重置 + 移动端适配基础 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: #212529;
}

.header p {
    font-size: 0.9rem;
    color: #6c757d;
}

/* 摄像头区域 */
.camera-area {
    margin-bottom: 20px;
}

.camera-area h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #212529;
}

.camera-container {
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3; /* 保持摄像头画面比例 */
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-text {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #fff;
    background-color: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* 状态区域 */
.status-area {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.status-card {
    flex: 1;
    min-width: 280px;
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-card h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #212529;
    display: flex;
    align-items: center;
}

.status-card h2::before {
    margin-right: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.status-item.detailed {
    flex-direction: column;
    align-items: flex-start;
}

.label {
    color: #6c757d;
}

.value {
    color: #007bff;
    font-weight: bold;
}

/* 控制区域 */
.control-area {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-area h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #212529;
}

/* 方向按键空间布局 */
.direction-pad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 25px;
}

.dir-btn {
    padding: 18px 10px;
    border: none;
    border-radius: 10px;
    background-color: #007bff;
    color: #fff;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation; /* 禁用浏览器默认触摸行为 */
}

.dir-btn:hover, .dir-btn:active {
    background-color: #0056b3;
    transform: scale(1.03);
}

/* 停止按钮特殊样式 */
.stop-btn {
    grid-column: 2 / 3;
    background-color: #dc3545;
    padding: 25px 10px;
    font-size: 1.05rem;
}

.stop-btn:hover, .stop-btn:active {
    background-color: #c82333;
}

/* 后退按钮居中 */
.back-btn {
    grid-column: 1 / 4;
    background-color: #28a745;
}

.back-btn:hover, .back-btn:active {
    background-color: #218838;
}

/* 速度调节区域 */
.speed-control {
    text-align: center;
}

.speed-control h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #212529;
}

#speed-slider {
    width: 80%;
    height: 8px;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
}

#speed-display {
    display: inline-block;
    width: 40px;
    text-align: center;
    color: #007bff;
    font-weight: bold;
    font-size: 1.1rem;
    vertical-align: middle;
}

.confirm-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background-color: #ffc107;
    color: #212529;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
}

.confirm-btn:hover {
    background-color: #e0a800;
}

/* 日志区域 */
.log-area {
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.log-area h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #212529;
}

#log-container {
    min-height: 80px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.6;
}

/* 移动端适配优化（屏幕宽度 < 768px） */
@media (max-width: 768px) {
    .direction-pad {
        gap: 8px;
    }

    .dir-btn {
        padding: 15px 5px;
        font-size: 0.85rem;
    }

    .stop-btn {
        padding: 20px 5px;
        font-size: 0.95rem;
    }

    #speed-slider {
        width: 70%;
    }

    .confirm-btn {
        padding: 6px 15px;
        font-size: 0.85rem;
    }
}